<?php

/***
 * 描述：商品变更记录
 * @category		Lib
 * @package			Model			
 * @subpackage	
 * @author			wanght <whtaok@gmail.com>
 * @since			2013-7-30
 * @version			$Id: ProductLogModel.class.php 3 2013-10-14 02:49:41Z whtaok@gmail.com $
 */
class ProductLogModel extends CommonModel {
	/**
	 * 商品变更日志 type:stock,price
	 * @access		public
	 * @author		wanght<whtaok@gmail.com>
	 * @since		2013-3-3
	 */
	function logData($type,$prod_data){
		$user = session(SES_USER);
		$data = $prod_data;
		$data['type'] = $type;
		$data['crt_time'] = time();
		$data['crt_user'] = $user['name'];
		$this->add($data);
		
	}
	/**
	 * 查询商品变更日志列表
	 * @access		public
	 * @author		wanght<whtaok@gmail.com>
	 * @since		2013-3-3
	 */
	function findListPage($search,$order='id desc'){
		if($search['start_date']){
			$search['start_date'] = strtotime($search['start_date']);
		}
		if($search['end_date']){
			$search['end_date'] = strtotime($search['end_date']);
		}
		$totalRows = $this->setModWhere($search)->count();
		
		$rtnData = $this->setModWhere($search)->order($order)->listPage($totalRows);
		return $rtnData;
	}
}

?>